#include <LiquidCrystal.h>

    int led = 0;

int microseconds;
int seconds;
int minutes;
int hours;

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd1(26, 27, 22, 23, 24, 25);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd1.begin(16, 2);
  // Print a message to the LCD.
  lcd1.print("Run time:");
  seconds = 0;//This starts the time at 0.
}

void loop() {
  
  delay(1000);
  
  
//The below section of code emulates a clock. The 1-second delay above
//ensures proper timing.
    while(microseconds < 60)
    {
      microseconds += 1;
    }
    if (microseconds >= 60)
    {
      microseconds = 0;
      seconds += 1;
    }  
    if (seconds >= 60)
    {
      seconds = 0;
      minutes += 1;
    }
    if(minutes >= 60)
    {
      minutes = 0;
      hours += 1;
    }

lcd1.setCursor(0,1);
lcd1.print("            ");
//The above space ensures that when the time goes from a 2-digit
//number to a 1-digit number, that the second digit doesn't
//remain as an artifact. For example, if this space was not
//included, the seconds may show as follows: 58, 59, 19, 29, 39.
  lcd1.setCursor(0, 1);
lcd1.print(hours);
lcd1.print(":");
lcd1.print(minutes);
lcd1.print(":");
lcd1.print(seconds);
lcd1.print(" ");
}
